{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "CI builds metadata secrets",
  "type": "object",
  "patternProperties": {
    ".*": {
      "type": "object",
      "patternProperties": {
        "^vault$": {
          "type": "object",
          "required": ["path", "field", "engine"],
          "properties": {
            "path": { "type": "string" },
            "field": { "type": "string" },
            "engine": {
              "type": "object",
              "required": ["name", "path"],
              "properties": {
                "path": { "type": "string" },
                "name": { "type": "string" }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        "^azure_key_vault$": {
          "type": "object",
          "required": ["name"],
          "properties": {
            "name": { "type": "string" },
            "version": { "type": ["string", "null"] }
          },
          "additionalProperties": false
        },
        "^file$": { "type": "boolean" },
        "^token$": { "type": "string" }
      },
      "anyOf": [
        {
          "required": [
            "vault"
          ]
        },
        {
          "required": [
            "azure_key_vault"
          ]
        }
      ],
      "additionalProperties": false
    }
  }
}
